package com.yc.common.secure.process;


import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @program: model_project
 * @description: Security 未登录处理 Handler
 * @author: 作者 huchaojie
 * @create: 2023-06-11 11:26
 */
@Component
public class SecureAuthenticationEntryPoint implements AuthenticationEntryPoint {

    @Override
    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException {
        response.sendRedirect(request.getContextPath()+"/nologin");
    }
}
